package com.frejoys.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.frejoys.common.dto.admin.StoreIdAndNameDto;
import com.frejoys.common.dto.app.StoreWalletLogPageDto;
import com.frejoys.common.dto.common.IdDto;
import com.frejoys.common.dto.store.StoreCashDto;
import com.frejoys.common.dto.store.StoreCashListDto;
import com.frejoys.common.dto.store.StoreIdAndPageDto;
import com.frejoys.common.vo.admin.StoreWalletListVo;
import com.frejoys.common.vo.app.StoreWalletLogListVo;
import com.frejoys.common.vo.app.StoreWalletLogPageVo;
import com.frejoys.common.vo.store.StoreCashListVo;
import com.frejoys.dao.entity.StoreWalletLog;

import java.math.BigDecimal;
import java.util.List;

public interface StoreWalletLogService extends IService<StoreWalletLog> {

    default StoreWalletLog getOnly(QueryWrapper<StoreWalletLog> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    default StoreWalletLog getOnly(LambdaQueryWrapper<StoreWalletLog> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    /**
     * 添加信息
     * @param storeId
     * @param money
     * @param cashMoney
     * @param cashCharges
     * @param drawSn
     * @param type
     * @param createTime
     * @param status
     * @return
     */
    boolean addInfo(Integer storeId, BigDecimal money, BigDecimal cashMoney, BigDecimal cashCharges, Long drawSn, Integer type, Integer createTime, Integer status);

    /**
     * 获取店铺钱包记录
     *
     * @param dto
     * @param userId
     * @return
     */
//    List<StoreWalletLogListVo> storeWalletListInfo(StoreIdAndPageDto dto);

    //后台分页查询用户钱包信息
    Page<StoreWalletLogPageVo> walletLogPage(StoreWalletLogPageDto dto);

    // 店铺申请提现
    boolean walletCash(Long userId, StoreCashDto dto);

    //后台审核商家提现
    boolean checkStoreWalletLog(IdDto dto);

    //店铺提现记录列表
    List<StoreCashListVo> storeCashListInfo(StoreCashListDto dto);
}
